#include "lh_label.h"

extern const u8 PerfLabData[];


void LH_LabelEve(void *widget)
{
    LH_WIDGET *DilgFoc = widget;
    
    if (DilgFoc->WidFlags & LH_WIDREDR)     
    { 
        LH_U16 StrX = DilgFoc->Axis_X, 
               StrY = DilgFoc->Axis_Y;
        
        if(DilgFoc->WidFlags & LH_SHOWHC)
        {
            if (*DilgFoc->Path1 != LH_NULL)
                LH_ShowBmpAt(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Path1);
        }
        else
            if (*DilgFoc->Path2 != LH_NULL)
            {
                if (LH_CmpStr((LH_S8 *)DilgFoc->Path2, "GUI/di0/lab0_2.bmp"))
                    TFT_Bmp(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Length, DilgFoc->Width, PerfLabData);
                else
                    LH_ShowBmpAt(DilgFoc->Axis_X, DilgFoc->Axis_Y, DilgFoc->Path2);
            }
        
        if (DilgFoc->Length != 0)
            StrX += DilgFoc->Length/2-GetStringNum(DilgFoc->PData)*8/2;
        if (DilgFoc->Width != 0)   
            StrY += DilgFoc->Width/2-8;
        
        if (LH_CmpStr((LH_S8 *)DilgFoc->Path2, "GUI/di0/lab0_2.bmp"))
            TFT_String(StrX, StrY, DilgFoc->PData, DilgFoc->WidColor);
        else
            LH_ShowStrAt(StrX, StrY, DilgFoc->PData, DilgFoc->WidColor);
    }
}




